// 获取当前城市
const getCurrentCityName = function () {
  return new Promise((resolve, reject) => {
    const myCity = new BMap.LocalCity()
    myCity.get((result) => {
      const geoc = new BMap.Geocoder()
      geoc.getLocation(result.center, (rs) => {
        // rs 中携带着所有的定位信息，这里只获取了城市(city)和所在的区(district)
        const addComp = rs.addressComponents
        resolve({
          province: addComp.province,
          city: addComp.city,
          district: addComp.district
        })
      })
    }, { enableHighAccuracy: true })
  })
}
export default getCurrentCityName
